import * as sdk from './fetch';

const controllerName = 'RepairController';

/**
 *
 * 查询报修列表
 *
 */
async function repairList(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost(
    'repair/findList',

    {
      ...params
    },
  );
  return result;
}
/**
 *
 * 新增报修
 *
 */
async function repairAdd(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost(
    'repair/add',

    {
      ...params
    },
  );
  return result;
}
/**
 *
 * 查询投诉维权列表
 *
 */
async function complaintList(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost(
    'plaint/findList',

    {
      ...params
    },
  );
  return result;
}
/**
 *
 * 新增投诉维权
 *
 */
async function complaintAdd(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost(
    'plaint/add',

    {
      ...params
    },
  );
  return result;
}
/**
 *
 * 更新用户信息
 *
 */
async function personalUpdate(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost(
    'generalSettings/improveData',

    {
      ...params
    },
  );
  return result;
}

export default {
  repairList,
  repairAdd,
  complaintList,
  complaintAdd,
  personalUpdate,
};

/**
 * 正常请求返回
 */
export interface BaseResponseString {
  /**
   * 结果码
   */
  code: string;
  /**
   * 内容
   */
  data?: {
    [k: string]: any;
  };
  /**
   * 错误内容
   */
  errorData?: {
    [k: string]: any;
  };
  /**
   * 状态
   */
  success?: boolean;
  /**
   * 消息内容
   */
  message?: string;
  [k: string]: any;
}
